<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="perm" uri="/WEB-INF/tld/perm.tld"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<script>var ctx="${ctx}";</script>
<div class="form-horizontal" role="form" >
    <input id="id" value="${positionAdvert.id}"  type="hidden"/>
	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">图片:</label>
        <div class="col-md-9">
        	 <input class="fileInput" id="imageUploadify" type="file" name="file" multiple="multiple" accept="image/*"/>
        	 <div class="imageUploadify">   
				<c:if test="${not empty(positionAdvert.image)}">
				<img src="${positionAdvert.image}" style="width: 60px;height: 60px">
				</c:if>
			 </div>
        </div>
    </div>
	<div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">广告链接:</label>
        <div class="col-md-9">
        	 <input id="url" value="${positionAdvert.url}"  type="text" placeholder="广告链接" class="form-control" name="url"/>
        </div>
    </div>
    <div class="form-group">
 	    <label class="col-md-3 col-sm-3 control-label">内容:</label>
        <div class="col-md-9">
        	 <script type="text/plain" id="editor">${positionAdvert.content}</script>
        </div>
    </div>
</div>

<script>
$(function(){
	//UE.getEditor('editor2').destroy();
	 //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
   UE.delEditor("editor");
 ue=UE.getEditor('editor',{
    //这里可以选择自己需要的工具按钮名称,此处仅选择如下五个
    toolbars: [[
	   'fullscreen', 'source', '|', 'undo', 'redo', '|',
       'bold', 'italic', 'underline', 'fontborder', 'removeformat', 'formatmatch', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist',
       'rowspacingtop', 'rowspacingbottom', 'lineheight', '|',
       'customstyle', 'paragraph', 'fontfamily', 'fontsize', '|',
       'indent',
       'justifyleft', 'justifycenter', 'justifyright', 'justifyjustify', '|',
       'link', 'unlink','simpleupload', 'insertimage','insertvideo'
	 ]],
     //关闭字数统计
     wordCount:false,
     initialFrameHeight:200,
     //关闭elementPath
     elementPathEnabled:false
	})
})
</script>
<script>
$("#imageUploadify").uploadify({
	'buttonImage':'${ctx}/static/js/plugins/uploadify/uploadify-button.png',
    'swf': '${ctx}/static/js/plugins/uploadify/uploadify.swf',
    'uploader':'${ctx}/file/uploadOss',
    'onFallback' : function() {//检测FLASH失败调用 
    	alert("您未安装FLASH控件，无法上传图片！请安装FLASH控件后再试。");  
    },  
    'onUploadSuccess':function(file, data, response){
    	var jData = jQuery.parseJSON(data);
        $(".imageUploadify").html("<img src=\""+jData.data+"\" style=\"width: 60px;height: 60px;\">");
	}
});

	 
</script>